<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../css/login.css">
    <script src="../jquery/jquery-3.6.0.min.js"></script>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
</head>
<body>
<div class="login">
    <h1>阳光幼儿园管理系统</h1>
    <div class="userName">
        <input id="userName" placeholder="请输入用户名">
    </div>
    <div class="userPassword">
        <input id="userPassword" placeholder="请输入密码">
    </div>
    <!--<div id="msg" style="color: red;">
        <label></label>
    </div>-->
    <button class="login_btn" data-toggle="modal" data-target="#myModal" onclick="check()">登录</button>


    <!-- Modal -->
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">

                <div class="modal-body">
                    <div id="msg"></div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">确定</button>

                </div>
            </div>
        </div>
    </div>

</div>

<script src="../data/data.js"></script>
<script src="../bootstrap/js/bootstrap.min.js"></script>
<script>
    function check() {
        let userName=document.getElementById("userName")
        let userPassword=document.getElementById("userPassword")
        let msg=document.getElementById("msg")
        if (userName.value==""||userPassword.value==""){
            msg.innerText="用户名或密码不能为空"
           /* msg.style.display="block"
            msg.style.marginLeft="860px"*/
            return
        }
        for (let i=0;i<user.length;i++)
        if (userName.value==user[i].account&&userPassword.value==user[i].password){
            msg.innerText="登录成功"
            /*msg.style.display="block"
            msg.style.marginLeft="860px"*/
            window.location.href="home.html"
            return
        }
        else {
            msg.innerText="用户名或密码错误"
            /*msg.style.display="block"
            msg.style.marginLeft="860px"*/
        }
    }
</script>


</body>
</html>